//
//  PersonalViewController.m
//  AoJi
//
//  Created by IMacLife on 15/1/28.
//  Copyright (c) 2015年 xuanheng. All rights reserved.
//

#import "PersonalViewController.h"
#import "SettingViewController.h"

#import "Color.h"

@interface PersonalViewController ()

@end
#define buttonWidth3 self.view.frame.size.width/3
#define buttonWidth self.view.frame.size.width/4
@implementation PersonalViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor=[UIColor colorWithRed:236.0f/255.0f green:236.0f/255.0f blue:236.0f/255.0f alpha:1.0f];
    
    
    //    UIView * assistView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 50)];
    //    assistView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"dingbujianbian"]];
    //    [bgImg addSubview:assistView];
    
    
    bgImg = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 212)];
    bgImg.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"perbg.png"]];
    [self.view addSubview:bgImg];
    

    
    UIButton *quitBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    quitBtn.frame = CGRectMake(0, 20, 44, 44);
    quitBtn.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"quxiao"]];
    [quitBtn addTarget:self action:@selector(quitAction) forControlEvents:UIControlEventTouchUpInside];
    [bgImg addSubview:quitBtn];
    
    UIButton *settingBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    settingBtn.frame = CGRectMake(self.view.frame.size.width-44, 20, 44, 44);
    settingBtn.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"shezhi"]];
    [settingBtn addTarget:self action:@selector(settingAction) forControlEvents:UIControlEventTouchUpInside];
    [bgImg addSubview:settingBtn];
    
    [self loadData];
    
    UIImageView *touxiang = [[UIImageView alloc]initWithFrame:CGRectMake(self.view.frame.size.width/2-40, CGRectGetMaxY(bgImg.frame)/2-60, 90, 90)];
    touxiang.layer.cornerRadius = touxiang.frame.size.width/2;
    touxiang.layer.masksToBounds = YES;
    
    //有头像用头像,没有头像用系统头像
    if ([[NSUserDefaults standardUserDefaults]objectForKey:@"avatar"]) {
        [touxiang sd_setImageWithURL:[NSURL URLWithString:[[NSUserDefaults standardUserDefaults]objectForKey:@"avatar"]] placeholderImage:[UIImage imageNamed:@"morentouxiang"]];
    }else{
        touxiang.image = [UIImage imageNamed:@"morentouxiang"];
    }
    [bgImg addSubview:touxiang];
    
    userLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.view.frame.size.width/2-50, 140, 100, 20)];
    NSString *username = [[NSUserDefaults standardUserDefaults]objectForKey:@"username"];
    userLabel.text=username;
    userLabel.font=[UIFont systemFontOfSize:14];
    userLabel.textColor=[UIColor whiteColor];
    userLabel.textAlignment=NSTextAlignmentCenter;
    [bgImg addSubview:userLabel];

    UIImageView * addressImg = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"kuang"]];
    addressImg.frame=CGRectMake(self.view.frame.size.width/2-65, 170, 130, 25);
    UIImageView*img =[[UIImageView alloc]initWithImage:[UIImage imageNamed:@"dingwei"]];
    img.frame=CGRectMake(10, 3, 15, 20);
    [addressImg addSubview:img];
    UILabel *addressLabel = [[UILabel alloc]initWithFrame:CGRectMake(20, 3, 100, 20)];
    NSString *address = [[NSUserDefaults standardUserDefaults]objectForKey:@"address"];
    addressLabel.text=address;
    addressLabel.font=[UIFont systemFontOfSize:14];
    addressLabel.textColor=[UIColor whiteColor];
    addressLabel.textAlignment=NSTextAlignmentCenter;
    [addressImg addSubview:addressLabel];
    [bgImg addSubview:addressImg];

    
    //buttonBG
    _buttonBG = [[UIView alloc]initWithFrame:CGRectMake(0, 207, self.view.frame.size.width, 50)];
    _buttonBG.backgroundColor=[UIColor whiteColor];
    [self.view addSubview:_buttonBG];
    
    _role = [kUserDefaults integerForKey:kRole];
    switch (_role) {
        case USER_ROLE_NORMAL:
            //注册用户
            [self setRoleNormalButton];
            
            //button颜色
            colorArray = @[[Color colorFromHexRGB:@"3ec37d"], [Color colorFromHexRGB:@"fe4b4b"], [Color colorFromHexRGB:@"f96004"]];
            break;
            
        case USER_ROLE_STUDY:
            //留学签约用户
            [self setRoleStudyButton];
            
            colorArray = @[[Color colorFromHexRGB:@"51c889"],[Color colorFromHexRGB:@"66cccc"], [Color colorFromHexRGB:@"fe4b4b"], [Color colorFromHexRGB:@"f96004"]];
            break;
            
        case USER_ROLE_TRAIN:
            //培训签约用户
            [self setRoleTrainButton];
            
            colorArray = @[[Color colorFromHexRGB:@"51c889"],[Color colorFromHexRGB:@"6680cc"], [Color colorFromHexRGB:@"fe4b4b"], [Color colorFromHexRGB:@"f96004"]];
            break;
            
        case USER_ROLE_ADVISER:
            //咨询顾问
            [self setRoleAdviserButton];
            
            colorArray = @[[Color colorFromHexRGB:@"51c889"],[Color colorFromHexRGB:@"fe4b4b"],[Color colorFromHexRGB:@"e6507b"], [Color colorFromHexRGB:@"a02de2"]];
            break;
        default:
            break;
    }
    
//    //默认显示第一个
   [self btnAction:[_buttonBG viewWithTag:100]];
    
}

//加载基本信息
-(void)loadData
{
    [YHNetwork getInformationWithReguestType:RequestTypePost WithParameters:nil WithApi:@"me/profile" WhenSuccess:^(NSMutableDictionary *response) {
        NSLog(@"%@",response);
         array= response;
        
        if (_role == USER_ROLE_ADVISER) {
            
        //label  顾问
            [userLabel removeFromSuperview];
            userLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.view.frame.size.width/2-50, 140, 100, 20)];
            userLabel.text=[NSString stringWithFormat:@"%@",array[0][@"ItemValue"]];
            userLabel.font=[UIFont systemFontOfSize:14];
            userLabel.textColor=[UIColor whiteColor];
            userLabel.textAlignment=NSTextAlignmentCenter;
            [bgImg addSubview:userLabel];

//            UILabel *number = [[UILabel alloc]initWithFrame:CGRectMake(5, 190, 90, 20)];
//            number.text=[NSString stringWithFormat:@"%@:%@",array[1][@"ItemTitle"],array[1][@"ItemValue"]];
//            number.font=[UIFont systemFontOfSize:12];
//            number.textColor=[UIColor whiteColor];
//            [number sizeToFit];
//            [bgImg addSubview:number];
//        
//            UILabel *consultant = [[UILabel alloc]initWithFrame:CGRectZero];
//            consultant.text=[NSString stringWithFormat:@"%@:%@",array[2][@"ItemTitle"],array[2][@"ItemValue"]];
//            consultant.font=[UIFont systemFontOfSize:12];
//            consultant.textColor=[UIColor whiteColor];
//            [consultant sizeToFit];
//        consultant.frame = CGRectMake(Mainwidth-consultant.frame.size.width-5, 190, consultant.frame.size.width,consultant.frame.size.height );
//            [bgImg addSubview:consultant];
        }else
        if(_role == USER_ROLE_STUDY ){
        
        //label  留学
            [userLabel removeFromSuperview];
        userLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.view.frame.size.width/2-50, 140, 100, 20)];
        userLabel.text=[NSString stringWithFormat:@"%@",array[1][@"ItemValue"]];
        userLabel.font=[UIFont systemFontOfSize:14];
        userLabel.textColor=[UIColor whiteColor];
        userLabel.textAlignment=NSTextAlignmentCenter;
        [bgImg addSubview:userLabel];
        
        UILabel *number = [[UILabel alloc]initWithFrame:CGRectMake(5, 190, 90, 20)];
        NSString *numStr = @"用户";
        number.text=[NSString stringWithFormat:@"%@%@:%@",numStr,array[0][@"ItemTitle"],array[0][@"ItemValue"]];
        number.font=[UIFont systemFontOfSize:12];
        number.textColor=[UIColor whiteColor];
        [number sizeToFit];
        [bgImg addSubview:number];
        
        UILabel *consultant = [[UILabel alloc]initWithFrame:CGRectZero];
        consultant.text=[NSString stringWithFormat:@"%@:%@",array[3][@"ItemTitle"],array[3][@"ItemValue"]];
        consultant.font=[UIFont systemFontOfSize:12];
        consultant.textColor=[UIColor whiteColor];
        [consultant sizeToFit];
        consultant.frame = CGRectMake(Mainwidth-consultant.frame.size.width-5, 190, consultant.frame.size.width,consultant.frame.size.height );
        [bgImg addSubview:consultant];
        
        } else if(_role == USER_ROLE_TRAIN ){
            
            //label  签约
            [userLabel removeFromSuperview];
            userLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.view.frame.size.width/2-50, 140, 100, 20)];
            userLabel.text=[NSString stringWithFormat:@"%@",array[2][@"ItemValue"]];
            userLabel.font=[UIFont systemFontOfSize:14];
            userLabel.textColor=[UIColor whiteColor];
            userLabel.textAlignment=NSTextAlignmentCenter;
            [bgImg addSubview:userLabel];
            
            UILabel *number = [[UILabel alloc]initWithFrame:CGRectMake(5, 190, 90, 20)];
            number.text=[NSString stringWithFormat:@"%@:%@",array[0][@"ItemTitle"],array[0][@"ItemValue"]];
            number.font=[UIFont systemFontOfSize:12];
            number.textColor=[UIColor whiteColor];
            [number sizeToFit];
            [bgImg addSubview:number];
            
        }
        
        
        NSLog(@"%@",array[0][@"ItemTitle"]);
        NSLog(@"%@",array[0][@"ItemValue"]);
        
        NSLog(@"%@",array[1][@"ItemTitle"]);
        NSLog(@"%@",array[1][@"ItemValue"]);
        
        NSLog(@"%@",array[2][@"ItemTitle"]);
        NSLog(@"%@",array[2][@"ItemValue"]);
        
//        NSLog(@"%@",array[3][@"ItemTitle"]);
//        NSLog(@"%@",array[3][@"ItemValue"]);
//        
//        NSLog(@"%@",array[4][@"ItemTitle"]);
//        NSLog(@"%@",array[4][@"ItemValue"]);
//        
//        NSLog(@"%@",array[5][@"ItemTitle"]);
//        NSLog(@"%@",array[5][@"ItemValue"]);
//        
//        NSLog(@"%@",array[6][@"ItemTitle"]);
//        NSLog(@"%@",array[6][@"ItemValue"]);
        
    } WhenFailure:^(NSError *failure) {
        NSLog(@"%@",failure);
    }];
}
    

#pragma mark - --------------------根据Role加载对应的按钮
#pragma mark 普通用户
- (void)setRoleNormalButton
{
    NSArray *btntitle =@[@"我的动态",@"个人收藏",@"基本信息"];
    NSArray *btnImg =@[@"wo-d-domngtai.png",@"rerenshouc.png",@"gerenxingx.png"];
    for (int i = 0; i < 3; i++)
    {
        UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
        btn.frame = CGRectMake(i*buttonWidth3, 0, buttonWidth3, 50);
        btn.tag=100+i;
        [btn setImage:[UIImage imageNamed:[btnImg objectAtIndex:i]] forState:UIControlStateNormal];
        [btn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
            
        UILabel *btnLabel = [[UILabel alloc]init];
        btnLabel.frame =CGRectMake(i, 30, buttonWidth3, 20);
        btnLabel.text=[btntitle objectAtIndex:i];
        btnLabel.textAlignment=NSTextAlignmentCenter;
        btnLabel.font = [UIFont systemFontOfSize:11];
        [btn addSubview:btnLabel];
            
        UIView *line = [[UIView alloc]init];
        line.frame=CGRectMake(buttonWidth3-1, 5, 1, 40);
        line.backgroundColor=[Color colorFromHexRGB:@"e6e6e8"];
        [btn addSubview:line];
        
        [_buttonBG addSubview:btn];
    }
}
    
#pragma mark 留学用户
- (void)setRoleStudyButton
{
    
    NSArray *studiesTitle =@[@"我的动态",@"我的留学",@"个人收藏",@"基本信息"];
    NSArray *studiesImg =@[@"wo-d-domngtai.png",@"wod-liuxue.png",@"rerenshouc.png",@"gerenxingx.png"];
    
    for (int i = 0; i < 4; i++)
    {
        UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
        btn.frame = CGRectMake(i*buttonWidth, 0, buttonWidth, 50);
        btn.tag=100+i;
        [btn setImage:[UIImage imageNamed:[studiesImg objectAtIndex:i]] forState:UIControlStateNormal];
        [btn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
        
        UILabel *btnLabel = [[UILabel alloc]init];
        btnLabel.frame =CGRectMake(i, 30, buttonWidth, 20);
        btnLabel.text=[studiesTitle objectAtIndex:i];
        btnLabel.textAlignment=NSTextAlignmentCenter;
        btnLabel.font = [UIFont systemFontOfSize:11];
        [btn addSubview:btnLabel];
        
        UIView *line = [[UIView alloc]init];
        line.frame=CGRectMake(buttonWidth-1, 5, 1, 40);
        line.backgroundColor=[Color colorFromHexRGB:@"e6e6e8"];
        [btn addSubview:line];
        
        [_buttonBG addSubview:btn];
    }
}
    
#pragma mark 签约用户
- (void)setRoleTrainButton
{
    NSArray *trainTitle =@[@"我的动态",@"我的培训",@"个人收藏",@"基本信息"];
    NSArray *trainImg =@[@"wo-d-domngtai.png",@"qianyueyonghu.png",@"rerenshouc.png",@"gerenxingx.png"];
    
    for (int i = 0; i < 4; i++)
    {
        UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
        btn.frame = CGRectMake(i*buttonWidth, 0, buttonWidth, 50);
        btn.tag=100+i;
        [btn setImage:[UIImage imageNamed:[trainImg objectAtIndex:i]] forState:UIControlStateNormal];
        [btn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
        
        UILabel *btnLabel = [[UILabel alloc]init];
        btnLabel.frame =CGRectMake(i, 30, buttonWidth, 20);
        btnLabel.text=[trainTitle objectAtIndex:i];
        btnLabel.textAlignment=NSTextAlignmentCenter;
        btnLabel.font = [UIFont systemFontOfSize:11];
        [btn addSubview:btnLabel];
       
        UIView *line = [[UIView alloc]init];
        line.frame=CGRectMake(buttonWidth-1, 5, 1, 40);
        line.backgroundColor=[Color colorFromHexRGB:@"e6e6e8"];
        [btn addSubview:line];
        
         [_buttonBG addSubview:btn];
    }
}
    
#pragma mark 咨询顾问
- (void)setRoleAdviserButton
{
        NSArray *consultantTitle =@[@"我的动态",@"个人收藏",@"资源池",@"个人客户"];
        NSArray *consultantImg =@[@"wo-d-domngtai.png",@"rerenshouc.png",@"ziyuanchi.png",@"gerenkehu.png"];
    
    for (int i = 0; i < 4; i++)
    {
        UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
        btn.frame = CGRectMake(i*buttonWidth, 0, buttonWidth, 50);
        btn.tag=100+i;
        [btn setImage:[UIImage imageNamed:[consultantImg objectAtIndex:i]] forState:UIControlStateNormal];
        [btn addTarget:self action:@selector(btnAction:) forControlEvents:UIControlEventTouchUpInside];
        
        UILabel *btnLabel = [[UILabel alloc]init];
        btnLabel.frame =CGRectMake(i, 30, buttonWidth, 20);
        btnLabel.text=[consultantTitle objectAtIndex:i];
        btnLabel.textAlignment=NSTextAlignmentCenter;
        btnLabel.font = [UIFont systemFontOfSize:11];
        [btn addSubview:btnLabel];
        
        UIView *line = [[UIView alloc]init];
        line.frame=CGRectMake(buttonWidth-1, 5, 1, 40);
        line.backgroundColor=[Color colorFromHexRGB:@"e6e6e8"];
        [btn addSubview:line];
        
        [_buttonBG addSubview:btn];
    }
}



#pragma mark  --------------------Action

//返回
-(void)quitAction
{

//    [_drawer open];
    //通知返回侧边栏
    [[NSNotificationCenter defaultCenter]postNotificationName:kSideMenuOpen object:@(2)];
    [_drawer open];
    
    //[self dismissViewControllerAnimated:YES completion:nil];
    [self.navigationController popViewControllerAnimated:YES];
}


//跳到设置
-(void)settingAction
{
    SettingViewController *settingVC = [[SettingViewController alloc]init];
    [self.navigationController pushViewController:settingVC animated:YES];
}

//用户
-(void)btnAction:(UIButton *)sender
{
        [[_selectedBtn viewWithTag:999]removeFromSuperview];
        [self setUnderlineWithSuperView:sender];
        _selectedBtn=sender;
        switch (_role) {
            case USER_ROLE_NORMAL:
                //普通用户
                [self reloadRoleNormalViewWithTag:sender.tag];
                break;
            case USER_ROLE_STUDY:
                //留学用户
                [self reloadRoleStudyViewWithTag:sender.tag];
                break;
            case USER_ROLE_TRAIN:
                //签约用户
                [self reloadRoleTrainViewWithTag:sender.tag];
                break;
            case USER_ROLE_ADVISER:
                //顾问
                [self reloadRoleAdviserViewWithTag:sender.tag];
                break;
            default:
                break;
        }
}

/**
 *  button颜色
 *
 *  @param superView 
 */
-(void)setUnderlineWithSuperView:(UIButton *)superView
{
    UIView *unserline = [[UIView alloc]initWithFrame:CGRectMake(0, superView.frame.size.height-3, superView.frame.size.width, 3)];
    unserline.backgroundColor=colorArray[superView.tag-100];
    unserline.tag=999;
    [superView addSubview:unserline];
}

#pragma mark -  --------------------点击按钮，根据role重新加载对应的视图
    /**
     *  普通用户
     *
     *  @param tag 按钮对应的tag，区分点击哪个按钮
     */
- (void)reloadRoleNormalViewWithTag:(NSInteger)tag{
        [dynamicView removeFromSuperview];
        [collectionView removeFromSuperview];
        [infoView removeFromSuperview];
        
        switch (tag) {
            case 100:
            {
                NSLog(@"我的动态");
                dynamicView = [[DynamicView alloc]initWithFrame:CGRectMake(0, 262, self.view.frame.size.width, self.view.frame.size.height-262)];
                dynamicView.viewController=self;
                [self.view addSubview:dynamicView];
            }
                break;
                
            case 101:
            {
                NSLog(@"个人收藏");
                collectionView = [[CollectionView alloc]initWithFrame:CGRectMake(0, 262, self.view.frame.size.width, self.view.frame.size.height-262)];
                [self.view addSubview:collectionView];
            }
                break;
                
            case 102:
            {
                NSLog(@"基本信息");
                infoView = [[InfoView alloc]initWithFrame:CGRectMake(0, 262, self.view.frame.size.width, self.view.frame.size.height-262)];
                [self.view addSubview:infoView];
            }
                break;
                
        }
    }

/**
 *  留学用户
 */
- (void)reloadRoleStudyViewWithTag:(NSInteger)tag
{
    [dynamicView removeFromSuperview];
    [studiesView removeFromSuperview];
    [collectionView removeFromSuperview];
    [infoView removeFromSuperview];
    
    switch (tag) {
        case 100:
        {
            NSLog(@"我的动态");
            dynamicView = [[DynamicView alloc]initWithFrame:CGRectMake(0, 262, self.view.frame.size.width, self.view.frame.size.height-262)];
            dynamicView.viewController=self;
            [self.view addSubview:dynamicView];
        }
            break;
            
        case 101:
        {
            NSLog(@"我的留学");
            studiesView = [[StudiesView alloc]initWithFrame:CGRectMake(0, 262, self.view.frame.size.width, self.view.frame.size.height-262)];
            [self.view addSubview:studiesView];
        }
            break;
            
        case 102:
        {
            NSLog(@"个人收藏");
            collectionView = [[CollectionView alloc]initWithFrame:CGRectMake(0, 262, self.view.frame.size.width, self.view.frame.size.height-262)];
            [self.view addSubview:collectionView];
        }
            break;
            
        case 103:
        {
            NSLog(@"基本信息");
            infoView = [[InfoView alloc]initWithFrame:CGRectMake(0, 262, self.view.frame.size.width, self.view.frame.size.height-262)];
            [self.view addSubview:infoView];
        }
            break;
            
    }
    
}

/**
 *  签约用户
 */
- (void)reloadRoleTrainViewWithTag:(NSInteger)tag
{   [dynamicView removeFromSuperview];
    [trainView removeFromSuperview];
    [collectionView removeFromSuperview];
    [infoView removeFromSuperview];
    
    switch (tag) {
        case 100:
        {
            NSLog(@"我的动态");
            dynamicView = [[DynamicView alloc]initWithFrame:CGRectMake(0, 262, self.view.frame.size.width, self.view.frame.size.height-262)];
            dynamicView.viewController=self;
            [self.view addSubview:dynamicView];
        }
            break;
            
        case 101:
        {
            NSLog(@"我的培训");
            trainView = [[TrainView alloc]initWithFrame:CGRectMake(0, 262, self.view.frame.size.width, self.view.frame.size.height-262)];
            [self.view addSubview:trainView];
        }
            break;
            
        case 102:
        {
            NSLog(@"个人收藏");
            collectionView = [[CollectionView alloc]initWithFrame:CGRectMake(0, 262, self.view.frame.size.width, self.view.frame.size.height-262)];
            [self.view addSubview:collectionView];
        }
            break;
            
        case 103:
        {
            NSLog(@"基本信息");
            infoView = [[InfoView alloc]initWithFrame:CGRectMake(0, 262, self.view.frame.size.width, self.view.frame.size.height-262)];
            [self.view addSubview:infoView];
        }
            break;
            
    }
}

/**
 *  咨询顾问
 */
- (void)reloadRoleAdviserViewWithTag:(NSInteger)tag
{
    [dynamicView removeFromSuperview];
    [collectionView removeFromSuperview];
    [resourcesView removeFromSuperview];
    [customerView removeFromSuperview];
    
    switch (tag) {
        case 100:
        {
            NSLog(@"我的动态");
            dynamicView = [[DynamicView alloc]initWithFrame:CGRectMake(0, 262, self.view.frame.size.width, self.view.frame.size.height-262)];
            dynamicView.viewController=self;
            [self.view addSubview:dynamicView];
        }
            break;
            
        case 101:
        {
            NSLog(@"个人收藏");
            collectionView = [[CollectionView alloc]initWithFrame:CGRectMake(0, 262, self.view.frame.size.width, self.view.frame.size.height-262)];
            [self.view addSubview:collectionView];
        }
            break;
            
        case 102:
        {
            NSLog(@"资源池");
            resourcesView = [[ResourcesView alloc]initWithFrame:CGRectMake(0, 262, self.view.frame.size.width, self.view.frame.size.height-262)];
            [self.view addSubview:resourcesView];
        }
            break;
            
        case 103:
        {
            NSLog(@"个人客户");
            customerView = [[CustomerView alloc]initWithFrame:CGRectMake(0, 262, self.view.frame.size.width, self.view.frame.size.height-262)];
            [self.view addSubview:customerView];
        }
            break;
            
    }
}



#pragma mark - ICSDrawerController

- (void)drawerControllerWillOpen:(ICSDrawerController *)drawerController
{
    self.view.userInteractionEnabled = NO;
}

- (void)drawerControllerWillClose:(ICSDrawerController *)drawerController
{
    self.view.userInteractionEnabled = YES;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
